package com.dg11185.nearshop.net.request;

import com.dg11185.libs.network.http.client.HttpRequest;
import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.response.GetReplyCommentListResponse;

/**
 * 获取主评论的回复
 * @author：Daibo    
 * @time：2014-5-16 下午1:17:17
 */
public class GetReplyCommentListRequest extends HttpRequest<GetReplyCommentListResponse>{

    public GetReplyCommentListRequest(String merchantId, String mainCommentId) {
        super(Constants.ADDRESS, Constants.getReplyCommentLis);
        addParam("chshToken", Constants.TOKEN);
        addParam("merchantId", merchantId);
        addParam("mainCommentId", mainCommentId);
    }

    /**
     * 添加可选参数
     * <param name="pageNumber">当前页</param>
     * <param name="pageSize">每页数量</param>
     */
    public GetReplyCommentListRequest add(String key, String value){
        addParam(key, value);
        return this;
    }
    
    public GetReplyCommentListRequest encryption(){
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }
    
    @Override
    protected GetReplyCommentListResponse parseJson(String response) throws Exception {

        GetReplyCommentListResponse r = new GetReplyCommentListResponse();
        r.parseJson(response);
        return r;
    }

}
